package com.exam.controller;

import com.exam.pojo.dto.CollErrorDTO;
import com.exam.pojo.dto.UserDTO;
import com.exam.pojo.vo.UserVO;
import com.exam.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/users")
@Api(tags = "用户接口")
@RequiredArgsConstructor
public class UserController {

    private final IUserService userService;

    @PostMapping
    @ApiOperation("新增用户")
    public void addUser(@RequestBody UserDTO dto){
        userService.addUser(dto);
    }

    @GetMapping("/{uuid}")
    @ApiOperation("查询用户信息")
    public UserVO getById(@PathVariable String uuid){
        return userService.findById(uuid);
    }

    @PostMapping("/handle")
    @ApiOperation("收藏与错误维护")
    public void handleQuestion(@RequestBody CollErrorDTO dto){
        userService.handleQuestion(dto);
    }
}
